package com.sxt.springcloud.sys.fallback;

import com.sxt.springcloud.sys.NoticeClientService;
import com.sxt.sys.common.DataGridView;
import com.sxt.sys.common.ResultObj;
import com.sxt.sys.vo.NoticeVo;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class NoticeClientFallbackService implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new NoticeClientService() {
            @Override
            public DataGridView loadAllNotice(NoticeVo noticeVo) {
                return new DataGridView("服务降级，服务器忙，请稍后重试！调用查询所有公共方法失败");
            }

            @Override
            public ResultObj addNotice(NoticeVo noticeVo) {
                return ResultObj.SERVER_BUSY;
            }

            @Override
            public ResultObj updateNotice(NoticeVo noticeVo) {
                return ResultObj.SERVER_BUSY;
            }

            @Override
            public ResultObj deleteNotice(Integer id) {
                return ResultObj.SERVER_BUSY;
            }

            @Override
            public ResultObj batchDeleteNotice(NoticeVo noticeVo) {
                return ResultObj.SERVER_BUSY;
            }
        };
    }
}
